package com.czl.module_storehouse.mvp.model;

import com.czl.base.data.bean.tengyun.LocatListBean;
import com.czl.base.data.net.RetrofitClient;
import com.czl.module_base.bean.ListBean;
import com.czl.module_base.http.HttpResponse;
import com.czl.module_storehouse.api.ApiService;

import org.json.JSONObject;

import io.reactivex.Observable;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * @author by xubin,
 * @date on 2022/2/21.
 * PS: Not easy to write code, please indicate.
 */
public class StorehouseLocationModel extends BasicDataModel {

    public Observable<HttpResponse<ListBean<LocatListBean>>> getStorehouseLocatList() {
        JSONObject object = new JSONObject();
        try {
            object.put("storehouseId", getStorehouseId());
        } catch (Exception e) {
            e.printStackTrace();
        }
        String json = object.toString();
        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
        return RetrofitClient.getInstance().create(ApiService.class).getStorehouseLocatList(RequestBody.create(mediaType, json));
    }
}
